package control.bd;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Connexion {

	public static Connection getConnexionBD() {
	        try {
	            Class.forName("com.mysql.jdbc.Driver").newInstance();
	
	            String host = "localhost";
				String database = "GJO2M";
				String login = "root";
				String password = "";
	
	            //Connection dbConnect = DriverManager.getConnection("jdbc:mysql://localhost/GJO2M", "root", "");
				Connection dbConnect = DriverManager.getConnection("jdbc:mysql://" + host + "/" + database, login, password);
	            return dbConnect;
	        } catch (SQLException ex) {
	            System.out.println(ex);
	        } catch (ClassNotFoundException ex) {
	        	 System.out.println(ex);
	        } catch (InstantiationException ex) {
	        	System.out.println(ex);
	        } catch (IllegalAccessException ex) {
	        	System.out.println(ex);
	        }
	        return null;
	    }
	
}
